﻿<ss:SlWindow xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"  xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"  
           x:Class="WorkSpace.UI.Windows.PersonalCategoryWindow"
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
           xmlns:ss="clr-namespace:SmartSpace.UI.Silverlight;assembly=SmartSpace.UI.Silverlight"
           xmlns:src="clr-namespace:WorkSpace.UI.Controls"
             Width="500"
             Height="400"
           Title="设置"
           Style="{StaticResource SlWindow}">

    <ss:SlWindow.Resources>
        <src:EnableVisibilityConverter x:Key="EnableVisibilityConverter"/>
        <src:DisableVisibilityConverter x:Key="DisableVisibilityConverter"/>

        <Style TargetType="ListBox">
            <Setter Property="Padding" Value="1"/>
            <Setter Property="Background" Value="#FFFFFFFF"/>
            <Setter Property="Foreground" Value="#FF000000"/>
            <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
            <Setter Property="VerticalContentAlignment" Value="Stretch"/>
            <Setter Property="IsTabStop" Value="False"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="TabNavigation" Value="Once"/>
            <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
            <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
            <Setter Property="BorderBrush">
                <Setter.Value>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#FFA3AEB9" Offset="0"/>
                        <GradientStop Color="#FF8399A9" Offset="0.375"/>
                        <GradientStop Color="#FF718597" Offset="0.375"/>
                        <GradientStop Color="#FF617584" Offset="1"/>
                    </LinearGradientBrush>
                </Setter.Value>
            </Setter>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ListBox">
                        <Grid>
                            <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="2">
                                <ItemsPresenter/>
                            </Border>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </ss:SlWindow.Resources>
    <Grid x:Name="LayoutRoot" Margin="2">
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <sdk:TabControl Grid.Row="0">
            <sdk:TabItem Header="应用连接管理">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="30"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>
                    <StackPanel Grid.Row="0" Orientation="Horizontal">
                        <TextBlock Text="页面:" VerticalAlignment="Center" Margin="1,0,0,0"/>
                        <TextBlock Name="_ctlEditPackage" Text="添加新页面" VerticalAlignment="Center" Margin="1,0,0,0"/>
                    </StackPanel>
                    <sdk:DataGrid Name="_ctlGridLink" Grid.Row="1" AutoGenerateColumns="False">
                        <sdk:DataGrid.Columns>
                            <sdk:DataGridTextColumn Header="名称" Binding="{Binding Path=Data.Caption}" IsReadOnly="True"/>
                            <sdk:DataGridTemplateColumn Header="设置">
                                <sdk:DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <StackPanel Orientation="Horizontal">
                                            <HyperlinkButton Name="_btnEnable" Click="_btnEnable_Click" Content="显示" Visibility="{Binding Path=IsSelected, Converter={StaticResource EnableVisibilityConverter}}" VerticalAlignment="Center"/>
                                            <HyperlinkButton Name="_btnDisable" Click="_btnDisable_Click" Content="隐藏" Visibility="{Binding Path=IsSelected, Converter={StaticResource DisableVisibilityConverter}}" VerticalAlignment="Center"/>
                                        </StackPanel>
                                    </DataTemplate>
                                </sdk:DataGridTemplateColumn.CellTemplate>
                            </sdk:DataGridTemplateColumn>
                        </sdk:DataGrid.Columns>
                    </sdk:DataGrid>
                </Grid>
            </sdk:TabItem>
            <sdk:TabItem Header="页面管理">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="30"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>
                    <StackPanel Grid.Row="0" Orientation="Horizontal">
                        <HyperlinkButton Name="_ctlBtnCreate" Click="_ctlBtnCreate_Click" Content="添加新页面" VerticalAlignment="Center"/>
                    </StackPanel>
                    <sdk:DataGrid Name="_ctlGridPackage" Grid.Row="1" AutoGenerateColumns="False">
                        <sdk:DataGrid.Columns>
                            <sdk:DataGridTextColumn Header="名称" Binding="{Binding Path=Caption}" IsReadOnly="True"/>
                            <sdk:DataGridTemplateColumn Header="设置">
                                <sdk:DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <StackPanel Orientation="Horizontal">
                                            <HyperlinkButton Name="_btnDelete" Click="_btnDelete_Click" Content="删除" VerticalAlignment="Center"/>
                                        </StackPanel>
                                    </DataTemplate>
                                </sdk:DataGridTemplateColumn.CellTemplate>
                            </sdk:DataGridTemplateColumn>
                        </sdk:DataGrid.Columns>
                    </sdk:DataGrid>
                </Grid>
            </sdk:TabItem>
        </sdk:TabControl>

        <StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center">
            <Button x:Name="OKButton" Content="确定" Click="OKButton_Click" Width="75" Height="25" Margin="5" />
        </StackPanel>
    </Grid>
</ss:SlWindow>